﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:GameLogic_Logic="clr-namespace:GameLogic.Logic;assembly=GameLogic"
    xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
    mc:Ignorable="d"
    x:Class="Pong.Game">

	<Grid
		x:Name="LayoutRoot" Width="768" Height="400">
		<Grid.Background>
			<LinearGradientBrush
				EndPoint="1,0"
				MappingMode="RelativeToBoundingBox"
				StartPoint="0,0">
				<GradientStop
					Color="Black"
					Offset="0" />
				<GradientStop
					Color="Black"
					Offset="1" />
				<GradientStop
					Color="#FF51584E"
					Offset="0.517" />
			</LinearGradientBrush>
		</Grid.Background>
		<Rectangle
			x:Name="_left"
			Width="5"
			HorizontalAlignment="Left">
			<Custom:Interaction.Behaviors>
				<GameLogic_Logic:StaticCollidableBehavior />
			</Custom:Interaction.Behaviors>
		</Rectangle>
		<Rectangle
			x:Name="_right"
			Width="5"
			HorizontalAlignment="Right">
			<Custom:Interaction.Behaviors>
				<GameLogic_Logic:StaticCollidableBehavior />
			</Custom:Interaction.Behaviors>
		</Rectangle>
		<Rectangle
			x:Name="_bottom"
			VerticalAlignment="Bottom"
			Height="5">
			<Custom:Interaction.Behaviors>
				<GameLogic_Logic:StaticCollidableBehavior />
			</Custom:Interaction.Behaviors>
		</Rectangle>
		<Rectangle
			x:Name="_top"
			VerticalAlignment="Top"
			Height="5">
			<Custom:Interaction.Behaviors>
				<GameLogic_Logic:StaticCollidableBehavior />
			</Custom:Interaction.Behaviors>
		</Rectangle>
		<Rectangle
			x:Name="_player"
			Height="100"
			Stroke="#FF1B186A"
			StrokeThickness="2"
			RadiusX="4"
			RadiusY="4"
			Width="15" HorizontalAlignment="Left" d:LayoutOverrides="Width" Margin="50,0,0,0" Canvas.ZIndex="2">
			<Custom:Interaction.Behaviors>
				<GameLogic_Logic:FollowMouseBehavior FollowPosition="Y" />
				<GameLogic_Logic:StaticCollidableBehavior />
			</Custom:Interaction.Behaviors>
			<Rectangle.Fill>
				<RadialGradientBrush>
					<GradientStop Color="#FF022DE4" Offset="0"/>
					<GradientStop Color="#FF0C0560" Offset="1"/>
				</RadialGradientBrush>
			</Rectangle.Fill>
		</Rectangle>
		<Rectangle
			x:Name="_cpu"
			Height="100"
			VerticalAlignment="Center"
			Stroke="#FF6C0808"
			StrokeThickness="2"
			RadiusX="4"
			RadiusY="4"
			Width="15"
			HorizontalAlignment="Right"
			Margin="0,0,50,0" Canvas.ZIndex="2">
			<Custom:Interaction.Behaviors>
				<GameLogic_Logic:StaticCollidableBehavior />
				<GameLogic_Logic:FollowMouseBehavior FollowPosition="Y" />
			</Custom:Interaction.Behaviors>
			<Rectangle.Fill>
				<RadialGradientBrush>
					<GradientStop Color="#FFE90808" Offset="0"/>
					<GradientStop Color="#FF490502" Offset="1"/>
				</RadialGradientBrush>
			</Rectangle.Fill>
		</Rectangle>
		<Ellipse
			x:Name="_ball"
			Stroke="#FF20251F"
			StrokeThickness="2"
			VerticalAlignment="Center"
			Height="25"
			Margin="70,0,0,0"
			Width="25"
			HorizontalAlignment="Left">
			<Custom:Interaction.Triggers>
				<GameLogic_Logic:CollisionTrigger SourceName="_right">
					<GameLogic_Logic:ChangeGamePropertiesAction ChangeScoresOnAction="True" ScoresIncrementValue="1"/>
				</GameLogic_Logic:CollisionTrigger>
				<GameLogic_Logic:CollisionTrigger SourceName="_left">
					<GameLogic_Logic:ChangeGamePropertiesAction ChangeLivesOnAction="True" LivesIncrementValue="-1"/>
				</GameLogic_Logic:CollisionTrigger>
			</Custom:Interaction.Triggers>
			<Custom:Interaction.Behaviors>
				<GameLogic_Logic:MovingCollidableBehavior
					CollisionType="Bounce"
					CollisionEnabled="True"
					Direction="180"
					Speed="3" AutoStart="True" />
			</Custom:Interaction.Behaviors>
			<Ellipse.Fill>
				<RadialGradientBrush>
					<GradientStop
						Color="#FFC5D0C2"
						Offset="0" />
					<GradientStop
						Color="#FF0E120C"
						Offset="1" />
				</RadialGradientBrush>
			</Ellipse.Fill>
		</Ellipse>
	</Grid>
</UserControl>